﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AzureToolkit.Engine
{
    internal class RecurrentJobSchedule : JobScheduleBase
    {
        TimeSpan timeBetweenRuns;

        public RecurrentJobSchedule(TimeSpan timeBetweenRuns, Type type)
        {
            this.type = type;
            this.timeBetweenRuns = timeBetweenRuns;
            this.nextRunTime = DateTime.UtcNow.Add(this.timeBetweenRuns);
            this.lastRunTime = DateTime.UtcNow;
        }

        public override void Increment()
        {
            this.lastRunTime = this.nextRunTime;
            this.nextRunTime = this.nextRunTime.Add(this.timeBetweenRuns);
        }
    }
}
